-- @作者: baidwwy
-- @邮箱:  313738139@qq.com
-- @创建时间:   2021-03-14 15:09:49
-- @最后修改来自: baidwwy
-- @Last Modified time: 2021-03-14 19:14:16

local names = 读入文件("tysj/Bot/botName.txt")
local 姓名列表 = table.loadstring(names)
print("加载了" .. #姓名列表 .. "个机器人名字")

function 随机门派(type)
	-- "方寸山","女儿村","神木林","化生寺","大唐官府","盘丝洞","阴曹地府","无底洞","魔王寨","狮驼岭","天宫","普陀山","凌波城","五庄观","龙宫","天机城","女魃墓","花果山","轮回司"
	local 门派 = {}
	门派.人 = {[1] = "大唐官府",[2]="化生寺",[3]="女儿村",[4]="神木林",[5]="天机城",[6]="方寸山"}
	门派.仙 = {[1] = "龙宫",[2]="天宫",[3]="五庄观",[4]="凌波城",[5]="普陀山",[6]="花果山"}
	门派.魔 = {[1]="魔王寨",[2]="狮驼岭",[3]="盘丝洞",[4]="阴曹地府",[5]="女魃墓",[6]="无底洞"}
	return 门派[type][math.random(1,#门派[type])]
end

function 随机造型( type )
	local 造型 = {}
	造型.人= { "剑侠客","逍遥生","飞燕女","英女侠","巫蛮儿","偃无师" }
	造型.仙 = {"龙太子","神天兵","舞天姬","玄彩娥","羽灵神","桃夭夭"}
	造型.魔 = {"狐美人","骨精灵","杀破狼","巨魔王","虎头怪","鬼潇潇"}
	return 造型[type][math.random(1,#造型[type])]
end

function 随机种族()
	local 种族 = { "人","仙","魔" }
	return 种族[math.random(1,#种族)]
end

local 所有武器 = {}
	所有武器.枪 = {"红缨枪","曲尖枪","锯齿矛","乌金三叉戟","火焰枪","墨杆金钩","玄铁矛","金蛇信","丈八点钢矛","暗夜","梨花","霹雳","刑天之逆","五虎断魂","飞龙在天","天龙破城","弑皇"}
	所有武器.斧钺 = {"青铜斧","开山斧","双面斧","双弦钺","精钢禅钺","黄金钺","乌金鬼头镰","狂魔镰","恶龙之齿","破魄","肃魂","无敌","五丁开山","元神禁锢","护法灭魔","碧血干戚","裂天"}
	所有武器.剑 = {"青铜短剑","铁齿剑","吴越剑","青锋剑","龙泉剑","黄金剑","游龙剑","北斗七星剑","碧玉剑","鱼肠","倚天","湛卢","魏武青虹","灵犀神剑","四法青云","霜冷九州","擒龙"}
	所有武器.双剑 = {"双短剑","镔铁双剑","龙凤双剑","竹节双剑","狼牙双剑","鱼骨双剑","赤焰双剑","墨玉双剑","梅花双剑","阴阳","月光双剑","灵蛇","金龙双剪","连理双树","祖龙对剑","紫电青霜","浮犀"}
	所有武器.飘带 = {"五色缎带","幻彩银纱","金丝彩带","无极丝","天蚕丝带","云龙绸带","七彩罗刹","缚神绫","九天仙绫","彩虹","流云","碧波","秋水落霞","晃金仙绳","此最相思","揽月摘星","九霄"}
	所有武器.爪刺 = {"铁爪","天狼爪","幽冥鬼爪","青龙牙","勾魂爪","玄冰刺","青刚刺","华光刺","龙鳞刺","撕天","毒牙","胭脂","九阴勾魂","雪蚕之刺","贵霜之牙","忘川三途","离钩"}
	所有武器.扇子 = {"折扇","铁骨扇","精钢扇","铁面扇","百折扇","劈水扇","神火扇","阴风扇","风云雷电","太极","玉龙","秋风","画龙点睛","秋水人家","逍遥江湖","浩气长舒","星瀚"}
	所有武器.魔棒 = {"细木棒","金丝魔棒","玉如意","点金棒","云龙棒","幽路引魂","满天星","水晶棒","日月光华","沧海","红莲","盘龙","降魔玉杵","青藤玉树","墨玉骷髅","丝萝乔木","醍醐"}
	所有武器.锤 = {"松木锤","镔铁锤","八棱金瓜","狼牙锤","烈焰锤","破甲战锤","震天锤","巨灵神锤","天崩地裂","八卦","鬼牙","雷神","混元金锤","九瓣莲花","鬼王蚀日","狂澜碎岳","碎寂"}
	所有武器.鞭 = {"牛皮鞭","牛筋鞭","乌龙鞭","钢结鞭","蛇骨鞭","玉竹金铃","青藤柳叶鞭","雷鸣嗜血鞭","混元金钩","龙筋","百花","吹雪","游龙惊鸿","仙人指路","血之刺藤","牧云清歌","霜陨"}
	所有武器.环圈 = {"黄铜圈","精钢日月圈","离情环","金刺轮","风火圈","赤炎环","蛇形月","子母双月","斜月狼牙","如意","乾坤","月光双环","别情离恨","金玉双环","九天金线","无关风月","朝夕"}
	所有武器.刀 = {"柳叶刀","苗刀","夜魔弯刀","金背大砍刀","雁翅刀","破天宝刀","狼牙刀","龙鳞宝刀","黑炎魔刀","冷月","屠龙","血刃","偃月青龙","晓风残月","斩妖泣血","业火三灾","鸣鸿"}
	所有武器.法杖 = {"曲柳杖","红木杖","白椴杖","墨铁拐","玄铁牛角杖","鹰眼法杖","腾云杖","引魂杖","碧玺杖","业焰","玉辉","鹿鸣","庄周梦蝶","凤翼流珠","雪蟒霜寒","碧海潮生","弦月"}
	所有武器.弓弩 = {"硬木弓","铁胆弓","紫檀弓","宝雕长弓","錾金宝弓","玉腰弯弓","连珠神弓","游鱼戏珠","灵犀望月","非攻","幽篁","百鬼","冥火薄天","龙鸣寒水","太极流光","九霄风雷","若木"}
	所有武器.宝珠 = {"琉璃珠","水晶珠","珍宝珠","翡翠珠","莲华珠","夜灵珠","如意宝珠","沧海明珠","无量玉璧","离火","飞星","月华","回风舞雪","紫金葫芦","裂云啸日","云雷万里","赤明"}
	所有武器.巨剑 = {"钝铁重剑","桃印铁刃","赭石巨剑","壁玉长铗","青铜古剑","金错巨刃","惊涛雪","醉浮生","沉戟天戊","鸦九","昆吾","弦歌","墨骨枯麟","腾蛇郁刃","秋水澄流","百辟镇魂","长息"}
	所有武器.灯笼 = {"素纸灯","竹骨灯","红灯笼","鲤鱼灯","芙蓉花灯","如意宫灯","玲珑盏","玉兔盏","冰心盏","蟠龙","云鹤","风荷","金风玉露","凰火燎原","月露清愁","夭桃秾李","荒尘"}
	所有武器.伞 = {"油纸伞","红罗伞","紫竹伞","锦绣椎","幽兰帐","琳琅盖","孔雀羽","金刚伞","落梅伞","鬼骨","云梦","枕霞","碧火琉璃","雪羽穿云","月影星痕","浮生归梦","晴雪"}

function 机器人武器(造型)
	local 数据 = {}
	数据.剑侠客 = { "刀","剑" }
	数据.逍遥生 = { "扇子","剑" }
	数据.飞燕女 = { "双剑","环圈" }
	数据.英女侠 = { "双剑","鞭" }
	数据.巫蛮儿 = { "宝珠","法杖" }
	数据.偃无师 = { "巨剑","巨剑" }
	数据.龙太子 = { "枪","扇子" }
	数据.神天兵 = { "枪","锤" }
	数据.舞天姬 = { "飘带","环圈" }
	数据.玄彩娥 = { "飘带","魔棒" }
	数据.羽灵神 = { "弓弩","法杖" }
	数据.桃夭夭 = { "灯笼","灯笼" }
	数据.狐美人 = { "爪刺","鞭" }
	数据.骨精灵 = { "爪刺","魔棒" }
	数据.杀破狼 = { "弓弩","宝珠" }
	数据.巨魔王 = { "斧钺","刀" }
	数据.虎头怪 = { "斧钺","锤" }
	数据.鬼潇潇 = { "伞","伞" }
	local 类型 = 数据[造型][math.random(1,#数据[造型])]

	return {等级=160,名称=所有武器[类型][math.random(1,#所有武器[类型])],类别=类型}
end

-- 模板
-- {
	-- 摊位名称="1J变身卡",
	-- itemTable=1,BBTable=1,id=1,
	-- 地图数据={x=219*20,y=120*20,编号=1001},
	-- 名称="墨家美女",当前称谓="",模型="骨精灵",
	-- 武器={等级=160,强化=1,名称="铁爪",类别="爪刺"},
	-- 队长=false,锦衣="夏日清凉",
	-- 门派="阴曹地府",染色组={[1]=4,[2]=3,[3]=3},染色方案=2
-- }

local 生成摊位机器人 = class()

function 生成摊位机器人:init()
	self.摊位坐标 ={}

local 长安领双摊位数 = math.random(10,20)
local 长安酒店摊位数 = math.random(10,20)
local 长安传送摊位数 = math.random(10,20)
local 长安天台摊位数 = math.random(10,20)
local 长安门口摊位数 = math.random(10,20)
local 建邺门口摊位数 = math.random(10,20)
local 长寿门口摊位数 = math.random(10,20)
local 傲来天台摊位数 = math.random(10,20)

local low = 1
local hei = 长安领双摊位数
-- 长安双
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(206,246) * 20,y=math.random(100,131) * 20,编号=1001}
end
low = hei + 1
hei = low + 长安酒店摊位数

-- 长安酒店
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(464,500) * 20,y=math.random(120,148) * 20,编号=1001}
end
low = hei + 1
hei = low + 长安传送摊位数
-- 长安传送
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(250,300) * 20,y=math.random(235,260) * 20,编号=1001}
end
low = hei + 1
hei = low + 长安天台摊位数
-- 长安天台
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(245,395) * 20,y=math.random(30,60) * 20,编号=1001}
end
low = hei + 1
hei = low + 长安门口摊位数
-- 长安门口
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(420,450) * 20,y=math.random(225,250) * 20,编号=1001}
end

low = hei + 1
hei = low + 建邺门口摊位数
-- 建邺门口
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(42,86) * 20,y=math.random(100,130) * 20,编号=1501}
end

low = hei + 1
hei = low + 长寿门口摊位数
-- 长寿门口摊位数
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(88,125) * 20,y=math.random(147,180) * 20,编号=1070}
end

low = hei + 1
hei = low + 傲来天台摊位数
-- 傲来天台摊位数
for i=low,hei do
	self.摊位坐标[i] = {x=math.random(107,146) * 20,y=math.random(40,66) * 20,编号=1092}
end
	print("共有" .. #self.摊位坐标 .. "个坐标")
end

function 生成摊位机器人:generateBot(index)
	local 名称 = 姓名列表[math.random(1,#姓名列表)]
	local 种族 = 随机种族()
	local 模型 = 随机造型(种族)
	local 武器 = 机器人武器(模型)
	local 门派 = 随机门派(种族)
	return {
		摊位名称="杂货摊位",
		itemTable=1,BBTable=1,id=1,
		地图数据=self.摊位坐标[index],
		名称=名称,当前称谓="",模型=模型,
		武器=武器,
		队长=false,锦衣="",
		门派=门派,
		染色组={[1]=math.random(1,4),[2]=math.random(1,4),[3]=math.random(1,4)},染色方案=math.random(1,4)
	}
end

function 生成摊位机器人:generateBotList()
	local botList = {}
	for i=1,#self.摊位坐标 do
		botList[i] = self:generateBot(i)
	end
	return botList
end

return 生成摊位机器人
